package day01

/**
  * Created by root on 2018/11/21.
  */
object WordCount {
  def main(args: Array[String]): Unit = {
    val arr = Array("hello tom","how are you","i miss you")
    val by: List[(String, Int)] = arr.flatMap(x=>x.split(" ")).map(x=>(x,1)).groupBy(x=> x._1 ).map(x=>(x._1,x._2.size)).toList.sortBy(x=>x._2).reverse

    println(by)
  }

}
